package com.platform.enums;

import java.util.concurrent.TimeUnit;

/**
 * Description:数据库连接池配置字段
 *
 * @author zyk
 */
public enum CPSettingField {

    MAX_POOL_SIZE("maxPoolSize","最大连接数",20L,1L),

    MIN_IDLE("minIdle","最小空闲连接数", 2L,0L),

    CONNECTION_TIMEOUT("connectionTimeout","连接超时时间",TimeUnit.SECONDS.toMillis(30L),250L),

    VALIDATION_TIMEOUT("validationTimeout","连接测试活动的最长时间",TimeUnit.SECONDS.toMillis(5L),25L),

    IDLE_TIMEOUT("idleTimeout","空闲超时时间",TimeUnit.MINUTES.toMillis(10L),10000L),

    MAX_LIFETIME("maxLifetime","连接最大超时时间",TimeUnit.MINUTES.toMillis(30L),30000L),

    LEAK_DETECTION_THRESHOLD("leakDetectionThreshold","连接被占用的超时时间",0L,0L);

    CPSettingField(String field, String desc, Long defaultValue, Long minValue) {
        this.field = field;
        this.desc = desc;
        this.defaultValue = defaultValue;
        this.minValue = minValue;
    }

    private  String field;

    private  String desc;

    private  Long defaultValue;

    private  Long minValue;

    public String getField() {
        return field;
    }

    public void setField(String field) {
        this.field = field;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Long getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(Long defaultValue) {
        this.defaultValue = defaultValue;
    }

    public Long getMinValue() {
        return minValue;
    }

    public void setMinValue(Long minValue) {
        this.minValue = minValue;
    }}

